package com.gitee.dolt.core.base.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.gitee.dolt.annotation.injection.InjectionField;
import com.gitee.dolt.core.constant.InjectionFieldConstants;
import com.gitee.dolt.model.RemoteData;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * 包括id、create_time、created_by、updated_by、update_time字段的表继承的基础实体
 *
 * @author LYH
 */
@Getter
@Setter
@Accessors(chain = true)
@ToString(callSuper = true)
public class RemoteDataEntity<T,U> extends SuperRemoteDataEntity<T,U> {

    private static final long serialVersionUID = 7324302905203451391L;
    @ApiModelProperty(value = "最后修改时间")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    protected LocalDateTime updateTime;

    @ApiModelProperty(value = "最后修改人ID")
    @TableField(value = "updated_by", fill = FieldFill.INSERT_UPDATE)
    @InjectionField(api = InjectionFieldConstants.USER_ITEM_CLASS, method = InjectionFieldConstants.USER_ITEM_METHOD)
    protected RemoteData<T, U> updatedBy;

    public RemoteDataEntity(T id, LocalDateTime createTime, RemoteData<T, U> createdBy, LocalDateTime updateTime, RemoteData<T, U> updatedBy) {
        super(id, createTime, createdBy);
        this.updateTime = updateTime;
        this.updatedBy = updatedBy;
    }

    public RemoteDataEntity() {
    }


}
